<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>智能数据洞察与问卷管理平台</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #1890ff;
            --success-color: #52c41a;
            --error-color: #ff4d4f;
            --text-dark: #1f2d3d;
            --text-light: #5e6c84;
            --border-color: #e4e7ed;
            --shadow-default: 0 4px 12px rgba(0,0,0,0.08);
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: #f5f7fa;
            line-height: 1.5;
            margin: 0;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        h1 {
            color: var(--primary-color);
            font-size: 28px;
            font-weight: bold;
            margin-bottom: 32px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
        }

        .question-list {
            display: flex;
            flex-direction: column;
            gap: 24px;
        }

        .question-card {
            background: white;
            border: 2px solid var(--primary-color);
            border-radius: 8px;
            padding: 16px;
            margin-bottom: 24px;
            transition: all 0.3s ease;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }

        .question-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
            border-color: var(--primary-color);
        }

        .question-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .question-type {
            color: var(--primary-color);
            font-size: 14px;
            font-weight: 500;
        }

        .status-indicator {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            margin-left: 10px;
        }

        .status-indicator.active {
            background-color: var(--success-color);
        }

        .question-content {
            font-size: 16px;
            margin-bottom: 16px;
            color: var(--text-dark);
        }

        .options {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .option-item {
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--text-dark);
        }

        .option-item span {
            font-weight: 600;
        }

        .button-container {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            margin-bottom: 20px;
        }

        .back-button {
            padding: 8px 16px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.3s;
            background: var(--primary-color);
            color: white;
            text-decoration: none;
        }

        .back-button:hover {
            background: #40a9ff;
            box-shadow: var(--shadow-default);
        }

        @media (max-width: 768px) {
            .question-card {
                margin-bottom: 16px;
                border: 2px solid var(--primary-color);
                box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            }

            h1 {
                font-size: 24px;
                margin-bottom: 24px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="button-container">
            <a href="{% url 'survey_list' %}" class="back-button">
                <i class="fas fa-arrow-left"></i> 返回问卷列表
            </a>
        </div>

        <h1>{{ survey.name }}</h1>

        <div class="question-list">
            {% if questions %}
                {% for question in questions %}
                <div class="question-card">
                    <div class="question-header">
                        <span class="question-type">{{ question.type }}</span>
                        <span class="status-indicator active"></span>
                    </div>
                    <div class="question-content">
                        {{ question.text }}
                    </div>

                    {% if question.type != 'text' %}
                    <div class="options">
                        {% for option in question.options %}
                        <div class="option-item">
                            <span>{{ forloop.counter }}.</span>
                            {{ option.text }}
                        </div>
                        {% endfor %}
                    </div>
                    {% endif %}
                </div>
                {% endfor %}
            {% else %}
            <div class="alert alert-info">
                暂无问题，点击返回创建问卷。
            </div>
            {% endif %}
        </div>
    </div>
</body>
</html>